using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LiveNation.Utilities {
	public static class DictionaryExtensions {
		/// <summary>
		/// Creates a simple {0}="{1}" list based on current object state.
		/// </summary>
		public static string ToAttributeList(this IDictionary<string, object> dictionary) {
			StringBuilder sb = new StringBuilder();
			string resultFormat = "{0}=\"{1}\"";
			dictionary.Keys.ForEach((key, i) => {
				if (i != 0)
					sb.Append(' ');
				sb.AppendFormat(resultFormat, key, dictionary[key]);
			});
			
			return sb.ToString();
		}
	}
}
